//
//  AppDelegate.swift
//  WBTest
//
//  Created by 张海峰 on 2017/7/20.
//  Copyright © 2017年 张海峰. All rights reserved.
/*
 注意swift语言部署版本时选择9.0 以上
 */

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var defaultViewController : UIViewController?{
      let isLogin :Bool = UserInfoViewModel.shareInstance.isLogin
        return isLogin ? WelcomeViewController() : UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController()
    }
    

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        //设置全局Tabbar颜色
        UITabBar.appearance().tintColor =  UIColor.orange
        UINavigationBar.appearance().tintColor = UIColor.red
       
        window = UIWindow(frame:  UIScreen.main.bounds)
        window?.rootViewController = defaultViewController
        window?.makeKeyAndVisible()
        return true
    }
    //定义一个全局函数打印方法
    //自定义标记 ->项目 ->buildSettings -> swift flag ->Debug ->  -D DEBUG
    func ZHFLog<T>(message : T, file : String = #file, line : Int = #line) {
        //在DEBUG环境下打印，在RELEASE环境下不打印
        #if DEBUG
            let file1 = (file as NSString).lastPathComponent
            let line1 = (line as Int)
            print("\(file1):line\(line1)---\(message)")
        #endif
    }

}

